<!-- detail modal -->
<div class="modal fade" id="detailModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div id="detailPegawai"></div>
		</div>
	</div>
</div>
<!-- end detail modal -->

<div id="page-wrapper">
    <!-- /.row -->
    <div class="row">
        <div class="col-sm-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <span class="judul-page">Master Pegawai</span>
                    <span class="pull-right">
                        <a href="<?php echo base_url()?>mr_pegawai/add" class="btn btn-warning btn-xs"><span class="glyphicon glyphicon-plus"></span>&nbsp;Tambah Data</a>
                    </span>
                    <div class="clearfix"></div>
                </div>
                <div class="panel-body">
                  <div class="row margin-bottom10">
                    <form class="form-inline" role="form" method="post" action="<?php echo site_url($aksi_cari);?>">
                      <div class="col-md-8">
                        
                      </div>
                      <div class="col-md-4">
                        <div class="input-group input-group-sm">
                          <input type="text" name="judul" value="<?php echo isset($param_judul)?$param_judul:''; ?>" class="form-control required email" placeholder="Pencarian..." title="Masukkan kata kunci">
                          <span class="input-group-btn">
                            <button type="submit" name="cari" class="btn btn-primary"><span class="glyphicon glyphicon-search"></span></button>
                          </span>
                        </div>
                      </div>
                    </form>
                  </div>
                    <div class="table-responsive">
                      <table class="table table-striped table-bordered table-hover">
                        <thead>
                            <tr>
                                <th>#</th>
                                <th width="100">NIP</th>
                                <th>Nama Lengkap</th>
                                <th>Telepon</th>
                                <th>JK</th>
                                <th>TTL</th>
                            </tr>
                        </thead>
                        <tbody>
						<?php 
							if(count($list)>0){
								$i = 1+$offset; 
								foreach ($list as $row) {
						?>										
                            <tr>
                                <td><?php echo $i++ ?></td>
                                <td><?php echo $row->nip; ?></td> 
                                <td><?php echo $row->nm_pegawai; ?></td> 
                                <td><?php echo $row->tlp; ?></td> 
                                <td><?php echo $row->jk; ?></td> 
                                <td><?php echo $row->tmp_lahir.', '.date("d-m-Y", strtotime ($row->tgl_lahir)); ?> 
									<span class="pull-right">
										<a href="<?php echo site_url('mr_pegawai/edit/'.$row->id_mr_pegawai);?>" class="btn btn-success btn-xs" title="Edit"><span class="glyphicon glyphicon-edit"></span></a>
										<a href="" data-toggle="modal" data-target="#detailModal" class="btn btn-info btn-xs" title="Detail" onclick="detail_pegawai('<?php echo $row->id_mr_pegawai;?>')"><span class="glyphicon glyphicon-file"></span></a>
										<a href="<?php echo site_url('mr_pegawai/delete/'.$row->id_mr_pegawai);?>" onclick="return confirm('Yakin Anda akan menghapus data Pegawai ini secara permanen?')" class="btn btn-danger btn-xs" title="Hapus"><span class="glyphicon glyphicon-trash"></span></a>
									</span>
								</td>
                            </tr>
						<?php
								}
							}else{
						?>
							<tr>
                                <td colspan="6"><center>Belum ada data Pegawai</center></td>
							</tr>
						<?php
							}
						?>
                        </tbody>
                      </table>
                    </div>
                    <div class="clearfix"></div>
                    <center>
                    <?php
                    echo ! empty($pagination) ? '<center><div class="pagination">' . $pagination . '</div></center>' : '';
                    ?>
                    </center>
                </div>
            </div>
        </div>
    </div>
    <!-- /.row -->
</div>
<!-- /#page-wrapper -->
<script>
function detail_pegawai(id_mr_pegawai){
		$.ajax({
			type: "POST",
			url : "<?php echo site_url(); ?>mr_pegawai/detail",
			data: "id_mr_pegawai="+id_mr_pegawai,
			cache: false,
			success: function(response) {
				$('#detailPegawai').html(response);
			}
		});
		return false;
	}	
</script>